home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 May: Tool Chest / Dev.CD May 97 TC.toast / Sample Code / Overview / CPlusTESample / TESample.r < prev    next >
Encoding:
Text File  |  1994-11-18  |  6.4 KB  |  287 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------------------
  2.  
  3.     Program:    CPlusTESample 2.0
  4.     File:        TESample.r
  5.     Uses:       TECommon.h
  6.  
  7.     by Andrew Shebanow
  8.     of Apple Macintosh Developer Technical Support
  9.  
  10.     Copyright © 1989-1990 Apple Computer, Inc.
  11.     All rights reserved.
  12.  
  13. ------------------------------------------------------------------------------------------*/
  14.  
  15. #include "SysTypes.r"
  16. #include "Types.r"
  17.  
  18. #include "TECommon.h"
  19.  
  20. resource 'vers' (1) {
  21.     0x02, 0x00, release, 0x00, verUS,
  22.     "2.00",
  23.     "2.00, Copyright © 1989-1990 Apple Computer, Inc."
  24. };
  25.  
  26. /* we use an MBAR resource to conveniently load all the menus */
  27.  
  28. resource 'MBAR' (rMenuBar, preload) {
  29.     { mApple, mFile, mEdit };        /* three menus */
  30. };
  31.  
  32.  
  33. resource 'MENU' (mApple, preload) {
  34.     mApple, textMenuProc,
  35.     0b1111111111111111111111111111101,    /* disable dashed line, enable About and DAs */
  36.     enabled, apple,
  37.     {
  38.         "About TESample…",
  39.             noicon, nokey, nomark, plain;
  40.         "-",
  41.             noicon, nokey, nomark, plain
  42.     }
  43. };
  44.  
  45. resource 'MENU' (mFile, preload) {
  46.     mFile, textMenuProc,
  47.     0b0000000000000000000100000000000,    /* enable Quit only, program enables others */
  48.     enabled, "File",
  49.     {
  50.         "New",
  51.             noicon, "N", nomark, plain;
  52.         "Open…",
  53.             noicon, "O", nomark, plain;
  54.         "-",
  55.             noicon, nokey, nomark, plain;
  56.         "Close",
  57.             noicon, "W", nomark, plain;
  58.         "Save",
  59.             noicon, "S", nomark, plain;
  60.         "Save As…",
  61.             noicon, nokey, nomark, plain;
  62.         "Revert",
  63.             noicon, nokey, nomark, plain;
  64.         "-",
  65.             noicon, nokey, nomark, plain;
  66.         "Page Setup…",
  67.             noicon, nokey, nomark, plain;
  68.         "Print…",
  69.             noicon, nokey, nomark, plain;
  70.         "-",
  71.             noicon, nokey, nomark, plain;
  72.         "Quit",
  73.             noicon, "Q", nomark, plain
  74.     }
  75. };
  76.  
  77. resource 'MENU' (mEdit, preload) {
  78.     mEdit, textMenuProc,
  79.     0b0000000000000000000000000000000,    /* disable everything, program does the enabling */
  80.     enabled, "Edit",
  81.      {
  82.         "Undo",
  83.             noicon, "Z", nomark, plain;
  84.         "-",
  85.             noicon, nokey, nomark, plain;
  86.         "Cut",
  87.             noicon, "X", nomark, plain;
  88.         "Copy",
  89.             noicon, "C", nomark, plain;
  90.         "Paste",
  91.             noicon, "V", nomark, plain;
  92.         "Clear",
  93.             noicon, nokey, nomark, plain;
  94.         "-",
  95.             noicon, nokey, nomark, plain;
  96.         "Select All",
  97.             noicon, "A", nomark, plain
  98.     }
  99. };
  100.  
  101.  
  102. /* this ALRT and DITL are used as an About screen */
  103.  
  104. resource 'ALRT' (rAboutAlert, purgeable) {
  105.     {40, 20, 160, 337 }, rAboutAlert, {
  106.         OK, visible, silent;
  107.         OK, visible, silent;
  108.         OK, visible, silent;
  109.         OK, visible, silent
  110.     };
  111. };
  112.  
  113. resource 'DITL' (rAboutAlert, purgeable) {
  114.     { /* array DITLarray: 5 elements */
  115.         /* [1] */
  116.         {88, 227, 108, 305},
  117.         Button {
  118.             enabled,
  119.             "OK"
  120.         },
  121.         /* [2] */
  122.         {8, 8, 24, 305 },
  123.         StaticText {
  124.             disabled,
  125.             "MultiFinder-Aware C++ TextEdit Application"
  126.         },
  127.         /* [3] */
  128.         {32, 8, 48, 305},
  129.         StaticText {
  130.             disabled,
  131.             "Copyright © 1989-1990 Apple Computer, Inc."
  132.         },
  133.         /* [4] */
  134.         {56, 8, 72, 305},
  135.         StaticText {
  136.             disabled,
  137.             "Brought to you by:"
  138.         },
  139.         /* [5] */
  140.         {80, 24, 112, 222},
  141.         StaticText {
  142.             disabled,
  143.             "Macintosh Developer Technical Support"
  144.         }
  145.     }
  146. };
  147.  
  148.  
  149. resource 'WIND' (rDocWindow, preload, purgeable) {
  150.     {64, 60, 314, 460},
  151.     zoomDocProc, invisible, goAway, 0x0, "untitled"
  152. };
  153.  
  154.  
  155. resource 'CNTL' (rVScroll, preload, purgeable) {
  156.     {-1, 385, 236, 401},
  157.     0, visible, 0, 0, scrollBarProc, 0, ""
  158. };
  159.  
  160.  
  161. resource 'CNTL' (rHScroll, preload, purgeable) {
  162.     {235, -1, 251, 386},
  163.     0, visible, 0, 0, scrollBarProc, 0, ""
  164. };
  165.  
  166. resource 'STR#' (kTEDocErrStrings, purgeable) {
  167.     {
  168.     "Not enough memory to run TESample.";
  169.     "Not enough memory to do Cut.";
  170.     "Error during Cut.";
  171.     "Error during Copy.";
  172.     "Cannot exceed 32,000 characters with Paste.";
  173.     "Not enough memory to do Paste.";
  174.     "Cannot create window for document.";
  175.     "Document cannot exceed 32,000 characters.";
  176.     "Error during Paste.";
  177.     "Cannot open an unknown file type."
  178.     }
  179. };
  180.  
  181. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  182.  
  183. resource 'SIZE' (-1) {
  184.     dontSaveScreen,
  185.     acceptSuspendResumeEvents,
  186.     enableOptionSwitch,
  187.     canBackground,        /* we can background; we don't currently, but our sleep value */
  188.                         /* guarantees we don't hog the Mac while we are in the background */
  189.     multiFinderAware,    /* this says we do our own activate/deactivate; don't fake us out */
  190.     backgroundAndForeground, /* this is definitely not a background-only application! */
  191.     dontGetFrontClicks,    /* change this is if you want "do first click" behavior like the Finder */
  192.     ignoreChildDiedEvents,
  193.     is32BitCompatible,
  194.     reserved, reserved, reserved, reserved,
  195.     reserved, reserved, reserved,
  196.     kPrefSize * 1024,
  197.     kMinSize * 1024
  198. };
  199.  
  200.  
  201. type 'MOOT' as 'STR ';
  202.  
  203.  
  204. resource 'MOOT' (0) {
  205.     "MultiFinder-Aware TextEdit Sample Application"
  206. };
  207.  
  208.  
  209. resource 'BNDL' (128) {
  210.     'MOOT',
  211.     0,
  212.     {
  213.         'ICN#',
  214.         {
  215.             0, 128;
  216.             1, 129
  217.         },
  218.         'FREF',
  219.         {
  220.             0, 128;
  221.             1, 129
  222.         }
  223.     }
  224. };
  225.  
  226.  
  227. resource 'FREF' (128) {
  228.     'APPL',
  229.     0,
  230.     ""
  231. };
  232.  
  233.  
  234. resource 'ICN#' (128) {
  235.     { /* array: 2 elements */
  236.         /* [1] */
  237.         $"04 30 40 00 0A 50 A0 00 0B 91 10 02 08 22 08 03"
  238.         $"12 24 04 05 20 28 02 09 40 10 01 11 80 0C 00 A1"
  239.         $"80 03 FF C2 7E 00 FF 04 01 00 7F 04 03 00 1E 08"
  240.         $"04 E0 00 0C 08 E0 00 0A 10 E0 00 09 08 C0 00 06"
  241.         $"04 87 FE 04 02 88 01 04 01 88 00 84 00 88 00 44"
  242.         $"00 88 00 44 00 88 00 C4 01 10 01 88 02 28 03 10"
  243.         $"01 C4 04 E0 00 02 08 00 73 BF FB EE 4C A2 8A 2A"
  244.         $"40 AA AA EA 52 AA AA 24 5E A2 8A EA 73 BE FB 8E",
  245.         /* [2] */
  246.         $"04 30 40 00 0E 70 E0 00 0F F1 F0 02 0F E3 F8 03"
  247.         $"1F E7 FC 07 3F EF FE 0F 7F FF FF 1F FF FF FF BF"
  248.         $"FF FF FF FE 7F FF FF FC 01 FF FF FC 03 FF FF F8"
  249.         $"07 FF FF FC 0F FF FF FE 1F FF FF FF 0F FF FF FE"
  250.         $"07 FF FF FC 03 FF FF FC 01 FF FF FC 00 FF FF FC"
  251.         $"00 FF FF FC 00 FF FF FC 01 FF FF F8 03 EF FF F0"
  252.         $"01 C7 FC E0 00 03 F8 00 73 BF FB EE 7F BE FB EE"
  253.         $"7F BE FB EE 7F BE FB E4 7F BE FB EE 73 BE FB 8E"
  254.     }
  255. };
  256.  
  257. resource 'FREF' (129) {
  258.     'TEXT',
  259.     1,
  260.     ""
  261. };
  262.  
  263.  
  264. resource 'ICN#' (129) {
  265.     {    /* array: 2 elements */
  266.         /* [1] */
  267.         $"FFFF FFFF 8A50 0001 8B97 7F73 8820 0003"
  268.         $"922F 77C5 A020 0009 C011 EF11 800C 0021"
  269.         $"8003 FFC3 FE00 FF05 8100 7F05 8100 1E09"
  270.         $"B8E0 0009 80E0 0009 BCE0 0009 80C0 0005"
  271.         $"9C87 FE05 8088 0105 BC8B E085 8088 0045"
  272.         $"B08B 7845 8088 0045 9D13 DC89 8220 0111"
  273.         $"B1CF 6EE1 8000 0001 F3BF FBEF CCA2 8A2B"
  274.         $"C0AA AAEB D2AA AA25 DEA2 8AEB FFFF FFFF",
  275.         /* [2] */
  276.         $"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
  277.         $"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
  278.         $"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
  279.         $"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
  280.         $"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
  281.         $"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
  282.         $"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
  283.         $"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
  284.     }
  285. };
  286.  
  287.